/**
 * 
 */
package com.workable.assignment.domain;

import java.io.Serializable;
import java.util.List;

import com.workable.assignment.utilities.StringUtil;

/**
 * @author npapadopoulos
 * 
 */
public class Movie implements Serializable, Comparable<Movie> {

    /**
	 * 
	 */
    private static final long serialVersionUID = 1885434875750853186L;

    private String title;
    private String description;
    private Integer numberOfReviews;
    private String yearOfProduction;
    private List<String> starringActors;

    /**
     * @return the title
     */
    public String getTitle() {
        return title;
    }

    /**
     * @param title the title to set
     */
    public void setTitle(String title) {
        this.title = title;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Integer getNumberOfReviews() {
        return numberOfReviews;
    }

    public void setNumberOfReviews(Integer numberOfReviews) {
        this.numberOfReviews = numberOfReviews;
    }

    public String getYearOfProduction() {
        return yearOfProduction;
    }

    public void setYearOfProduction(String yearOfProduction) {
        this.yearOfProduction = yearOfProduction;
    }

    public List<String> getStarringActors() {
        return starringActors;
    }

    public void setStarringActors(List<String> starringActors) {
        this.starringActors = starringActors;
    }

    @Override
    public int hashCode() {
        return this.title.toLowerCase().trim().hashCode();
    }

    @Override
    public boolean equals(Object obj) {
        if (obj != null && obj instanceof Movie) {
            Movie move = (Movie) obj;
            return move.getTitle().toLowerCase().trim().equals(this.title.toLowerCase().trim());
        }
        return false;
    }

    @Override
    public String toString() {
        return StringUtil.toString(this);
    }

    @Override
    public int compareTo(Movie o) {
        if (o != null) {
            return o.getTitle().toLowerCase().trim().equals(this.title.toLowerCase().trim()) ? 0 : 1;
        }
        return -1;
    }

}